/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SimulationWindow.java
 *
 * Created on Mar 29, 2011, 10:21:29 PM
 */

package view;

import graph.Graph;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;

/**
 *
 * @author borysfan
 */
public class SimulationWindow extends javax.swing.JFrame {

    /** Creates new form SimulationWindow */
    public SimulationWindow() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        startBtn = new javax.swing.JButton();
        cancelBtn = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        startComboBox = new javax.swing.JComboBox();
        endComboBox = new javax.swing.JComboBox();
        cryteriumComboBox = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        trafficCB = new javax.swing.JCheckBox();
        weatherCondCB = new javax.swing.JCheckBox();
        roadConditionCB = new javax.swing.JCheckBox();
        stepByStepBtn = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Symulacja");
        setAlwaysOnTop(true);
        setBounds(new java.awt.Rectangle(100, 100, 0, 0));
        setResizable(false);

        startBtn.setText("Start");

        cancelBtn.setText("Anuluj");

        jLabel1.setText("Start:");

        jLabel2.setText("Koniec:");

        jLabel3.setText("Kryterium");

        startComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        startComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startComboBoxActionPerformed(evt);
            }
        });

        endComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        cryteriumComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel4.setText("Uwzględnij parametry:");

        trafficCB.setText("gęstość ruchu");
        trafficCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                trafficCBActionPerformed(evt);
            }
        });

        weatherCondCB.setText("warunki pogodowe");
        weatherCondCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                weatherCondCBActionPerformed(evt);
            }
        });

        roadConditionCB.setText("warunki drogowe");

        stepByStepBtn.setText("Krok po kroku");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(140, Short.MAX_VALUE)
                .addComponent(stepByStepBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(startBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(cancelBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18))
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2))
                        .addGap(30, 30, 30))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cryteriumComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(endComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(startComboBox, 0, 361, Short.MAX_VALUE))
                .addContainerGap(71, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(349, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(weatherCondCB)
                .addContainerGap(394, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(roadConditionCB)
                .addContainerGap(402, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(trafficCB)
                .addContainerGap(416, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(startComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(endComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cryteriumComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4)
                .addGap(7, 7, 7)
                .addComponent(roadConditionCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(weatherCondCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(trafficCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(startBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(stepByStepBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void startComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_startComboBoxActionPerformed

    private void trafficCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trafficCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_trafficCBActionPerformed

    private void weatherCondCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_weatherCondCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_weatherCondCBActionPerformed

    
  

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelBtn;
    private javax.swing.JComboBox cryteriumComboBox;
    private javax.swing.JComboBox endComboBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JCheckBox roadConditionCB;
    private javax.swing.JButton startBtn;
    private javax.swing.JComboBox startComboBox;
    private javax.swing.JButton stepByStepBtn;
    private javax.swing.JCheckBox trafficCB;
    private javax.swing.JCheckBox weatherCondCB;
    // End of variables declaration//GEN-END:variables

    public void addCloseAction(ActionListener listener) {
        cancelBtn.addActionListener(listener);
    }

    public void addStartAction(ActionListener listener){
        startBtn.addActionListener(listener);
    }

    public void addStartComboBoxItem(String name){
        startComboBox.addItem(name);
    }

    public void setStartComboBoxModel(DefaultComboBoxModel model) {
        startComboBox.setModel(model);
    }

    public void setEndComboBoxModel(DefaultComboBoxModel model){
        endComboBox.setModel(model);
    }

    public String getSelectedStart(){
        return (String)startComboBox.getSelectedItem();
    }

    public String getSelectedEnd(){
        return (String)endComboBox.getSelectedItem();
    }

    public String getSelectedCriteria(){
        return (String)cryteriumComboBox.getSelectedItem();
    }

    public void setCriteriaComboBoxModel(DefaultComboBoxModel model){
        cryteriumComboBox.setModel(model);
    }

    public int getSelectedItemIndex() {
        return cryteriumComboBox.getSelectedIndex();
    }

    public boolean isCheckedWeather() {
        return weatherCondCB.isSelected();
    }

    public boolean isCheckedRoad() {
        return roadConditionCB.isSelected();
    }

    public boolean isCheckedTraffic() {
        return trafficCB.isSelected();
    }

    public void addStepByStepAction(ActionListener action) {
       stepByStepBtn.addActionListener(action);
    }


}
